To insert a script in an HTML document, use the <script> tag. Use the type attribute to define the scripting language.

<script type="text/javascript">

Then comes the JavaScript: In JavaScript the command for writing some text on a page is document.write: 

document.write("Hello World!")

The script ends:

</script>